package com.example.aop_.aop;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;

@Slf4j
@Aspect
//@Component
public class AspectCut {
    @Pointcut("execution(* com.example.aop_.test.*.*(..))")
    public void pc() {}

    @Before("pc()")
    public void before(){
        log.info("执行before");
    }

    @After("pc()")
    public void after(){
        log.info("执行after");
    }
    @AfterReturning("pc()")
    public void AfterReturning(){
        log.info("执行AfterReturning");
    }
    @AfterThrowing("pc()")
    public void AfterThrowing(){
        log.info("执行AfterThrowing");
    }
    @Around("pc()")
    public void around(ProceedingJoinPoint pdj) throws Throwable {
        log.info("around方法执行前");
        pdj.proceed();
        log.info("around方法执行后");
    }
}
